package com.jet.office.inner;

import com.jet.core.result.ResultJson;
import com.jet.office.domain.entity.IndustryAttrEntity;
import com.jet.office.domain.vo.MerchantIndustryInfoVo;
import com.jet.office.service.IMerchantIndustryService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author dcl
 * @since 2025/2/21 17:33
 */
@RestController
@RequestMapping("/inner/office-edition/industry")
public class InnerIndustryController {

    private final IMerchantIndustryService merchantIndustryService;

    public InnerIndustryController(IMerchantIndustryService merchantIndustryService) {
        this.merchantIndustryService = merchantIndustryService;
    }

    @GetMapping("/info")
    public ResultJson<MerchantIndustryInfoVo> info(@RequestParam long merchantNo) {
        return ResultJson.ok(merchantIndustryService.industryInfo(merchantNo));
    }

    @GetMapping("/merchant-ability")
    public ResultJson<List<IndustryAttrEntity>> ability(@RequestParam long merchantNo) {
        return ResultJson.ok(merchantIndustryService.merchantChargeAbility(merchantNo));
    }

    /**
     * 开通试用版本
     *
     * @param merchantNo
     * @return
     */
    @PostMapping("/trial")
    public ResultJson<Void> industryTrial(@RequestParam long merchantNo,
                                          @RequestParam long storeNo,
                                          @RequestParam String accountId) {
        merchantIndustryService.industryTrial(merchantNo, storeNo, accountId);
        return ResultJson.ok();
    }
}
